package net.vinote.smart.platform.service.dw.html;

/**
 * input标签的显示形式
 */
public class InputCheckBoxTag extends HtmlTag {
	private String htmlTemplate = "<input type='checkbox' #attributes id='#id' /><label for='#id'>#showValue</label>";

	private String id;
	private String showValue;// 显示值

	public InputCheckBoxTag(HtmlTag htmlTag) {
		super(htmlTag);
	}

	@Override
	protected String getHtmlTemplate() {
		return htmlTemplate;
	}

	protected void initPlaceHolder() {
		placeholder.put("#id", id);
		placeholder.put("#showValue", showValue);
	}

	public void setChecked(boolean checked) {
		if (checked) {
			setAttribute("checked", "checked");
		} else {
			removeAttribute("checked");
		}
	}

	public void setId(String id) {
		this.id = id;
	}

	@Override
	public void setValue(String value) {
		setAttribute("value",value);
	}

	public void setShowValue(String showValue) {
		this.showValue = showValue;
	}
}
